home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2001 May / maximum-cd-2001-05.iso / Blade of Darkness / data1.cab / Program_Executable_Files / Lib / Scorer.py < prev    next >
Encoding:
Python Source  |  2000-11-16  |  31.4 KB  |  879 lines

  1. import BUIx
  2. import Bladex
  3. #import Bldb
  4. import ScorerWidgets
  5. import WidgetsExtra
  6. import ScorerActions
  7. import PowDefWidgets
  8. import Raster
  9. import B3DLib
  10. import math
  11. import CharStats
  12. import MenuText
  13. from Reference import ENERGY_LOW_LEVEL
  14. from Reference import DEMO_MODE
  15.  
  16.  
  17.  
  18.  
  19. CURRENT_LEVEL_R=0
  20. CURRENT_LEVEL_G=128
  21. CURRENT_LEVEL_B=255
  22.  
  23. CURRENT_STRENGTH_R=251
  24. CURRENT_STRENGTH_G=241
  25. CURRENT_STRENGTH_B=2
  26.  
  27.  
  28. E_ICON_DISTANCE = 37
  29. E_CENTRAL_DISTANCE = 20
  30. E_EDGAL_DISTANCE = 4
  31. E_ARROW_DISTANCE = 40
  32.  
  33.  
  34.  
  35. def ReorderEnemies(me,enemies,FacedName):
  36.     Left   = 0
  37.     Right  = 0
  38.     Result = [(-1,10.0), (-1,10.0),
  39.               (-1,10.0),
  40.               (-1,-10.0), (-1,-10.0)]
  41.     if FacedName:
  42.         CentralAngle = B3DLib.GetEntity2EntityAngle(me.Name,FacedName)
  43.     else:
  44.         CentralAngle = me.Angle
  45.     
  46.     for ename in range(len(enemies)):
  47.  
  48.         angle = ((B3DLib.GetEntity2EntityAngle(me.Name,enemies[ename][0]) - CentralAngle) % (3.1415*2))
  49.         if angle > 3.1415:
  50.             angle = angle-3.1415*2
  51.         
  52.         if math.fabs(angle) < math.fabs(Result[2][1]):
  53.             Result[2] = (ename,angle)
  54.         
  55.     for ename in range(len(enemies)):        
  56.  
  57.         angle = ((B3DLib.GetEntity2EntityAngle(me.Name,enemies[ename][0]) - CentralAngle) % (3.1415*2))
  58.         if angle > 3.1415:
  59.             angle = angle-3.1415*2
  60.  
  61.         if ename==Result[2][0]:
  62.             continue
  63.         if angle > 0:
  64.             if   angle < Result[1][1]:
  65.                 if Result[1][0] != -1:
  66.                     if Result[0][0] != -1:
  67.                         Left = Left+1
  68.                     Result[0] = Result[1]
  69.                 Result[1] = (ename,angle)
  70.             elif angle < Result[0][1]:
  71.                 if Result[0][0] != -1:
  72.                     Left = Left+1
  73.                 Result[0] = (ename,angle)
  74.             else:
  75.                 Left = Left+1
  76.         else:
  77.             if   angle > Result[3][1]:
  78.                 if Result[3][0] != -1:
  79.                     if Result[4][0] != -1:
  80.                         Right = Right+1
  81.                     Result[4] = Result[3]
  82.                 Result[3] = (ename,angle)                    
  83.             elif angle > Result[4][1]:
  84.                 if Result[4][0] != -1:
  85.                     Right = Right+1
  86.                 Result[4] = (ename,angle)
  87.             else:
  88.                 Right = Right+1
  89.     
  90.     return (Left,Right),Result
  91.     
  92.     
  93.     
  94.  
  95. def SetEnemiesData(pj):
  96.   enemies= pj.Data.visible_enemies
  97.   arrows,ienemies=ReorderEnemies(pj,enemies,pj.ActiveEnemy)
  98.   wEnemyBorderSelector.SetBorder(pj.ActiveEnemy!="")
  99.   wEnemyMark.SetVisible(pj.ActiveEnemy!="")
  100.   rw,rh=Raster.GetSize()
  101.   if wants_auto_scale:
  102.     if pj.ActiveEnemy:
  103.       wEnemies[2].SetSize(35*rw/640,35*rh/480)
  104.       wEnemiesVenoms[2].SetSize(35*rw/640,35*rh/480)
  105.     else:
  106.       wEnemies[2].SetSize(28*rw/640,28*rh/480)
  107.       wEnemiesVenoms[2].SetSize(28*rw/640,28*rh/480)
  108.   else:
  109.     if pj.ActiveEnemy:
  110.       wEnemies[2].SetSize(35,35)
  111.       wEnemiesVenoms[2].SetSize(35,35)
  112.     else:
  113.       wEnemies[2].SetSize(28,28)
  114.       wEnemiesVenoms[2].SetSize(28,28)
  115.   
  116.   wEnemyLeft.SetVisible(arrows[1]!=0)
  117.   wEnemyRight.SetVisible(arrows[0]!=0)
  118.  
  119.   for x in range(5):
  120.     
  121.     idx = ienemies[4-x][0]
  122.     if idx == -1:
  123.         wEnemies[x].SetVisible(0)
  124.         continue
  125.         
  126.     wEnemies[x].SetVisible(1)
  127.     try:
  128.         wEnemies[x].SetBitmap(enemies[idx][1][0])
  129.     except TypeError:
  130.         print "Bitmap not set for enemy "+enemies[idx][0]
  131.  
  132.     
  133.     chartype = Bladex.GetCharType(pj.CharType,pj.CharTypeExt)
  134.     if((x == 2) and (pj.ActiveEnemy != "")):
  135.       wEnemies[x].SetAlpha(1.0)
  136.     else:
  137.       Alpha = (chartype.MaxCombatDist-B3DLib.GetXZDistance(pj.Name,enemies[idx][0]))/chartype.MaxCombatDist
  138.       wEnemies[x].SetAlpha(Alpha)
  139.       
  140.     ent=Bladex.GetEntity(enemies[idx][0])    
  141.     if not ent:
  142.         print "The character called "+enemies[idx][0]+" has been destroyed"
  143.         continue
  144.     #apply(wEnemies[x].SetColor, ent.Data.CurrentHealthColor)
  145.     if ent.Data:
  146.         if ent.Data.Poisoned:
  147.             wEnemiesVenoms[x].SetVisible(1)
  148.         else:
  149.             wEnemiesVenoms[x].SetVisible(0)
  150.     else:
  151.         wEnemiesVenoms[x].SetVisible(0)
  152.         
  153.     wEnemiesLifeLabels[x].SetText(`int(ent.Life)`)
  154.     percentil  = ent.Life/CharStats.GetCharMaxLife(ent.Kind,ent.Level)
  155.     if percentil>1.0:
  156.         percentil = 1
  157.     wEnemyBarrLabels[x].SetPositionPercentage(percentil)
  158.     wEnemyBarrLabels[x].SetBackgroundAlpha(wEnemies[x].GetAlpha())
  159.     wEnemiesLevelLabels[x].SetText(`ent.Level+1`)
  160.     inv = ent.GetInventory()    
  161.     key_found= inv.GetSpecialKey(0)
  162.     if not key_found and inv.nKeys:
  163.       key_found= inv.GetKey(0)
  164.     if key_found:
  165.       object= Bladex.GetEntity(key_found)      
  166.       if wEnemiesKeyLabels[x].GetBOD()!=object.Kind:
  167.         wEnemiesKeyLabels[x].SetBOD(object.Kind)
  168.       wEnemiesKeyLabels[x].SetVisible(1)
  169.       if inv.nObjects:
  170.         object= Bladex.GetEntity(inv.GetObject(0))
  171.         if wEnemiesObjLabels[x].GetBOD()!=object.Kind:
  172.           wEnemiesObjLabels[x].SetBOD(object.Kind)
  173.         wEnemiesObjLabels[x].SetVisible(1)
  174.       else:
  175.         wEnemiesObjLabels[x].SetVisible(0)
  176.     else:
  177.       # If there's an object, put it in the key slot
  178.       if inv.nObjects:
  179.         object= Bladex.GetEntity(inv.GetObject(0))
  180.         if wEnemiesKeyLabels[x].GetBOD()!=object.Kind:
  181.           wEnemiesKeyLabels[x].SetBOD(object.Kind)
  182.         wEnemiesKeyLabels[x].SetVisible(1)
  183.       else:
  184.         wEnemiesKeyLabels[x].SetVisible(0)      
  185.       wEnemiesObjLabels[x].SetVisible(0)
  186.     wEnemies[x].RecalcLabelLayout(BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter)
  187.     wEnemies[x].RecalcLabelLayout(BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_Bottom)
  188.  
  189.   wEnemiesFrame.RecalcLayout()
  190.  
  191.  
  192. __wNULL=BUIx.CreateNULLWidget()
  193. char=Bladex.GetEntity("Player1")
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203. # Si esta a 1 hace que se escale el HUD, si esta a 0 entonces solo se ajustan las posiciones
  204. # (y ademas queda mejor), pero como es una opcion no soportada no esta terminada del todo.
  205. wants_auto_scale=1
  206.  
  207.  
  208. # Frames ---------------------------------------------------------------------------------------------------
  209. wFrame=BUIx.B_FrameWidget(__wNULL,"MainFrame",640,480)
  210. wLeftFrame=BUIx.B_FrameWidget(wFrame,"BarsFrame",195,65)
  211. wEnemiesFrame=BUIx.B_FrameWidget(wFrame,"EnemiesFrame",E_ICON_DISTANCE*5+E_CENTRAL_DISTANCE*2+E_ARROW_DISTANCE*2,65)
  212. wObjectsFrame=ScorerWidgets.B_ObjectsFrame(wFrame,"ObjectsFrame",125,65,char)
  213. #wKeysFrame=BUIx.B_FrameWidget(wFrame,"KeysFrame",50,65)
  214. wKeysRFrame=BUIx.B_FrameWidget(wFrame,"KeysRFrame",50,65)
  215. wSpecialsFrame=BUIx.B_FrameWidget(wFrame,"SpecialsFrame",180,32)
  216.  
  217.  
  218.  
  219. # Texto  ----------------------------------------------------------------------------------------------------
  220. wGameText=BUIx.B_TextWidget(wFrame,"GameTextWidget","\n\n\n\n\n",ScorerWidgets.font_server,"../../Data/Letras menu med.bmp")
  221. #wGameText=ScorerWidgets.B_GameTextWidget(wFrame,"GameTextWidget")
  222. wGameText.SetAlpha(1)
  223. wGameText.SetColor(255,255,255)
  224.  
  225.  
  226.  
  227. # Travel Book Warning--------------------------------------------------------------------------------------------
  228. TBookSword=BUIx.B_BitmapWidget(wFrame,"TBookSword",126,22,"PRESSF1","../../Data/pressf1.mmp")
  229. TBookSword.SetColor(255,255,255)
  230. wFrame.AddWidget(TBookSword,0,0,BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_Right,BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  231. TBookSword.SetAlpha(1.0)
  232. TBookSword.SetVisible(0)
  233.  
  234. TBS=Bladex.CreateSound("..\\..\\Sounds\\M-DESENFUNDA-PIEDRA.wav","TBWarning")
  235. TBS.Volume=1.0
  236. TBS.MinDistance=1000000.0
  237. TBS.MaxDistance=2000000
  238.  
  239. def SlideTBS(dir,time = 0):
  240.     TBS.PlayStereo()
  241.     SlideTBS2(dir,time)
  242.  
  243. def SlideTBS2(dir,time = 0):
  244.     
  245.     global TBookSword
  246.     MarcoAnchoTex = 201
  247.     if time < 0.25:
  248.         Bladex.AddScheduledFunc(Bladex.GetTime() + 0.015,SlideTBS2,(dir,time + 0.02))
  249.     else:
  250.         time = 0.25
  251.  
  252.     if dir:
  253.         XPos = -MarcoAnchoTex * time * 4
  254.     else:
  255.         TBookSword.SetVisible(1)
  256.         XPos = -MarcoAnchoTex + (MarcoAnchoTex * time * 4)
  257.  
  258.         wFrame.MoveWidgetTo("TBookSword",XPos,0)
  259.         
  260.     Bladex.AddScheduledFunc(Bladex.GetTime() + 10,HideTBS,())
  261.         
  262. def HideTBS():
  263.     global TBookSword
  264.     TBookSword.SetVisible(0)
  265.  
  266.  
  267.  
  268. # Barras de vida --------------------------------------------------------------------------------------------
  269. BAR_DELTA = 26
  270. Bladex.ReadBitMap("../../Data/Vida.bmp","Vida")
  271. Bladex.ReadBitMap("../../Data/Vida enemigo 8.bmp","BitmapBarraEnemigo")
  272.  
  273.  
  274.  
  275. wLifeBar=WidgetsExtra.B_FlashBarWidget(wLeftFrame,"LifeBar",116+BAR_DELTA,10)
  276. wLifeBar.SetColor(255,0,0)
  277. wLifeBar.SetFlashColor(53, 141, 36)
  278. wLifeBar.SetFlash(0)
  279. wLifeBar.Continuous= 1
  280. wLifeBar.SetBackgroundAlpha(0.0)
  281. wLifeBar.SetAlpha(1.0)
  282. wLifeBar.SetBitmap("Vida")
  283.     
  284.  
  285. ##def wLifeBarSizeChanged(x,y):
  286. ##  print "wLifeBarSizeChanged",x,y
  287. ##  
  288. ##wLifeBar.SetSizeChangedFunc(wLifeBarSizeChanged)
  289.  
  290. wLifeLabel=BUIx.B_TextWidget(wLifeBar,"LifeLabel","100/100",ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  291. wLifeLabel.SetColor(255,0,0)
  292. wLifeLabel.SetAlpha(1.0)
  293. wLifeBar.AddLabel(wLifeLabel,4-BAR_DELTA,-2,
  294.                   BUIx.B_Widget.B_LAB_Right,BUIx.B_Widget.B_LAB_VCenter,
  295.                   BUIx.B_Widget.B_FR_AbsoluteLeft,BUIx.B_Widget.B_FR_Left,
  296.                   BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top
  297.                   )
  298.  
  299.  
  300. wPoisonLabel=BUIx.B_TextWidget(wLifeBar,"PoisonLabel",MenuText.GetMenuText("POISONED"),ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  301. wPoisonLabel.SetColor(85,105,60)
  302. wPoisonLabel.SetAlpha(1.0)
  303. wLifeBar.AddLabel(wPoisonLabel,0.4,0.5,
  304.                   BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter,
  305.                   BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter,
  306.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  307.                   )
  308. wPoisonLabel.SetVisible(0)
  309.  
  310.  
  311.  
  312.  
  313. # Barra de nivel -------------------------------------------------------------------------------------------
  314. wLifeMarker = BUIx.B_BitmapWidget(wLeftFrame,"ObjNameBg",205,51,"MARCADORVIDAYXP","../../Data/marcadorvidayxp.mmp");
  315. wLifeMarker.SetColor(255,255,255)
  316. wLifeMarker.SetAlpha(1.0)
  317.  
  318.  
  319.  
  320. wLevelBar=ScorerWidgets.B_SmoothBarWidget(wLeftFrame,"LevelBar",116+BAR_DELTA,5)
  321. #wLevelBar=BUIx.B_BarWidget(wLeftFrame,"LevelBar",180,8)
  322. wLevelBar.SetColor(CURRENT_LEVEL_R,CURRENT_LEVEL_G,CURRENT_LEVEL_B)
  323. wLevelBar.SetAlpha(1.0)
  324. wLevelBar.SetBackgroundAlpha(0.0)
  325. wLevelBar.SetBackgroundColor(0,80,110)
  326.  
  327.  
  328. #wLevelUpLabel=BUIx.B_TextWidget(wLevelBar,"LevelUpLabel",MenuText.GetMenuText("LEVEL UP"),ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  329. wLevelUpLabel=WidgetsExtra.B_FlashTextWidget(wLevelBar,"LevelUpLabel",MenuText.GetMenuText("LEVEL UP"),ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  330. wLevelUpLabel.SetColor(170,170,170)
  331. wLevelUpLabel.SetAlpha(1.0)
  332. wLevelUpLabel.SetVisible(0)
  333. wLevelBar.AddLabel(wLevelUpLabel,0,2,
  334.                   BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_Bottom,
  335.                   BUIx.B_Widget.B_FR_AbsoluteRight,BUIx.B_Widget.B_FR_Right,
  336.                   BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top
  337.                   )
  338.  
  339.  
  340. wCurrentLevelLabel=BUIx.B_TextWidget(wLevelBar,"CurrentLevelLabel","Level 5",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  341. wCurrentLevelLabel.SetColor(0,159,220)
  342. wCurrentLevelLabel.SetAlpha(1.0)
  343. wLevelBar.AddLabel(wCurrentLevelLabel,6-BAR_DELTA,-4,
  344.                   BUIx.B_Widget.B_LAB_Right,BUIx.B_Widget.B_LAB_VCenter,
  345.                   BUIx.B_Widget.B_FR_AbsoluteLeft,BUIx.B_Widget.B_FR_Left,
  346.                   BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top
  347.                   )
  348. wLevelBar.SetBitmap("Vida")
  349.  
  350. # Barra de un bar    -------------------------------------------------------------------------------------------
  351. wLowBarFrame=BUIx.B_FrameWidget(wFrame,"LowBarFrame",176, 22)
  352. wLowBarFrame.SetVisible(1)
  353.  
  354.  
  355. wEnergyBmp=BUIx.B_BitmapWidget(wLowBarFrame,"EnergyBmp",176, 22,"MARCADORLANZAMAGOTAM","../../Data/marcadorlanzamagotam.mmp")
  356. wEnergyBmp.SetColor(255,255,255)
  357. wEnergyBmp.SetAlpha(1.0)
  358. wEnergyBmp.SetVisible(1)
  359.  
  360. # Barra de strength  -------------------------------------------------------------------------------------------
  361. wStrengthBar=ScorerWidgets.B_SmoothBarWidget(wLowBarFrame,"StrengthBar",112*(8.0/6.5),8)
  362. wStrengthBar.SetColor(CURRENT_STRENGTH_R,CURRENT_STRENGTH_G,CURRENT_STRENGTH_B)
  363. wStrengthBar.SetAlpha(0.75)
  364. wStrengthBar.SetBackgroundAlpha(0.0)
  365. wStrengthBar.SetBackgroundColor(CURRENT_STRENGTH_R,CURRENT_STRENGTH_G,CURRENT_STRENGTH_B)
  366. wStrengthBar.SetVisible(0)
  367. wStrengthBar.SetBitmap("Vida")
  368.  
  369. wMaxPowerLabel=WidgetsExtra.B_FlashTextWidget(wStrengthBar,"MaxPowerLabel",MenuText.GetMenuText("Maximun power"),ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  370. wMaxPowerLabel.SetColor(255,255,255)
  371. wMaxPowerLabel.SetAlpha(1.0)
  372. wMaxPowerLabel.SetVisible(0)
  373. wStrengthBar.AddLabel(wMaxPowerLabel,0.4,0.5,
  374.                   BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter,
  375.                   BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter,
  376.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  377.                   )
  378.  
  379. wStrengthLabel=WidgetsExtra.B_FlashTextWidget(wStrengthBar,"StrengthLabel",MenuText.GetMenuText("Launch"),ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  380. wStrengthLabel.SetColor(251,210,99)
  381. wStrengthLabel.SetAlpha(1.0)
  382. wStrengthLabel.SetFlash(0.0)
  383. wStrengthBar.AddLabel(wStrengthLabel,9,0.5,
  384.                   BUIx.B_Widget.B_LAB_Left,BUIx.B_Widget.B_LAB_VCenter,
  385.                   BUIx.B_Widget.B_FR_AbsoluteRight,BUIx.B_Widget.B_FR_Right,
  386.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  387.                   )
  388.  
  389. #wStrengthBar.SetBitmap("BitmapBarra")
  390.  
  391. # Barra de energy  -------------------------------------------------------------------------------------------
  392. wEnergyBar=ScorerWidgets.B_SmoothBarWidget(wLowBarFrame,"EnergyBar",112*(8.0/6.5),8)
  393. wEnergyBar.SetColor(0,255,128)
  394. wEnergyBar.SetAlpha(0.75)
  395. wEnergyBar.SetBackgroundAlpha(0.0)
  396. wEnergyBar.SetBackgroundColor(64,64,64)
  397. wEnergyBar.SetVisible(0)
  398. wEnergyBar.SetBitmap("Vida")
  399.  
  400. wDangerLabel=WidgetsExtra.B_FlashTextWidget(wEnergyBar,"DangerLabel",MenuText.GetMenuText("Low energy"),ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  401. wDangerLabel.SetColor(238,191,0)
  402. wDangerLabel.SetAlpha(1.0)
  403. wDangerLabel.SetVisible(0)
  404. wEnergyBar.AddLabel(wDangerLabel,0.4,0.5,
  405.                   BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter,
  406.                   BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter,
  407.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  408.                   )
  409.  
  410. wEnergyMaxLabel=WidgetsExtra.B_FlashTextWidget(wEnergyBar,"EnergyMaxLabel","100",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  411. wEnergyMaxLabel.SetColor(0,255,128)
  412. wEnergyMaxLabel.SetAlpha(1)
  413. wEnergyMaxLabel.SetVisible(1)
  414. wEnergyBar.AddLabel(wEnergyMaxLabel,7,0.5,
  415.                   BUIx.B_Widget.B_LAB_Left,BUIx.B_Widget.B_LAB_VCenter,
  416.                   BUIx.B_Widget.B_FR_AbsoluteRight, BUIx.B_Widget.B_FR_Right,
  417.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  418.                   )
  419.  
  420.  
  421. wLowBarFrame.AddWidget(wStrengthBar,56,6)
  422.  
  423. wLowBarFrame.AddWidget(wEnergyBar,56,6)
  424.  
  425. wLowBarFrame.AddWidget(wEnergyBmp,0,0)
  426.  
  427.  
  428. # Llaves ---------------------------------------------------------------------------------------------------
  429. wKey1=ScorerWidgets.B_InvKey3DWidget(wObjectsFrame,"Key1",32,32,"Llave",char)
  430. #wKey2=ScorerWidgets.B_InvKeyRing3DWidget(wKeysFrame,"Key2",32,32,"Llavero",char)
  431.  
  432. # Especials ---------------------------------------------------------------------------------------------------
  433. wSpecialKey1=ScorerWidgets.B_InvSpecialKeyWidget(wSpecialsFrame,"BEETLE",22,22,char)
  434. wSpecialKey2=ScorerWidgets.B_InvSpecialKeyWidget(wSpecialsFrame,"SPIDER",22,22,char)
  435. wSpecialKey3=ScorerWidgets.B_InvSpecialKeyWidget(wSpecialsFrame,"SHELL",22,22,char)
  436. wSpecialKey4=ScorerWidgets.B_InvSpecialKeyWidget(wSpecialsFrame,"STAR",22,22,char)
  437.  
  438. wTablet1=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla1","!",char)
  439. wTablet2=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla2","\"",char)
  440. wTablet3=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla3","#",char)
  441. wTablet4=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla4","$",char)
  442. wTablet5=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla5","%",char)
  443. wTablet6=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla6","&",char)
  444.  
  445.  
  446. """
  447. # Objetos --------------------------------------------------------------------------------------------------
  448. wSelObjectText=BUIx.B_TextWidget(wObjectsFrame,"SelObjectText","RED GEM  +10% EXP",
  449.                  ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  450. wSelObjectText.SetColor(170,170,170)
  451. wSelObjectText.SetAlpha(0.5)
  452. """
  453.  
  454.  
  455.  
  456. # Enemigos -------------------------------------------------------------------------------------------------
  457. wEnemy1,wEnemyVenom1,wEnemy1LifeLabel,wEnemy1LevelLabel,wEnemy1KeyLabel,wEnemy1ObjLabel,wEnemy1BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy1",wEnemiesFrame,wants_auto_scale)
  458. wEnemy1.SetAlpha(0.25)
  459.  
  460. wEnemy2,wEnemyVenom2,wEnemy2LifeLabel,wEnemy2LevelLabel,wEnemy2KeyLabel,wEnemy2ObjLabel,wEnemy2BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy2",wEnemiesFrame,wants_auto_scale)
  461. wEnemy2.SetAlpha(1.0)
  462.  
  463. wEnemy3,wEnemyVenom3,wEnemy3LifeLabel,wEnemy3LevelLabel,wEnemy3KeyLabel,wEnemy3ObjLabel,wEnemy3BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy3",wEnemiesFrame,wants_auto_scale,35)
  464. wEnemy3.SetAlpha(0.25)
  465.  
  466. wEnemy4,wEnemyVenom4,wEnemy4LifeLabel,wEnemy4LevelLabel,wEnemy4KeyLabel,wEnemy4ObjLabel,wEnemy4BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy4",wEnemiesFrame,wants_auto_scale)
  467. wEnemy4.SetAlpha(0.25)
  468.  
  469. wEnemy5,wEnemyVenom5,wEnemy5LifeLabel,wEnemy5LevelLabel,wEnemy5KeyLabel,wEnemy5ObjLabel,wEnemy5BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy5",wEnemiesFrame,wants_auto_scale)
  470. wEnemy5.SetAlpha(0.25)
  471.  
  472.  
  473.  
  474. wEnemies=[wEnemy1,wEnemy2,wEnemy3,wEnemy4,wEnemy5]
  475. wEnemiesVenoms=[wEnemyVenom1,wEnemyVenom2,wEnemyVenom3,
  476.                    wEnemyVenom4,wEnemyVenom5]
  477. wEnemiesLifeLabels=[wEnemy1LifeLabel,wEnemy2LifeLabel,wEnemy3LifeLabel,
  478.                    wEnemy4LifeLabel,wEnemy5LifeLabel]
  479. wEnemiesLevelLabels=[wEnemy1LevelLabel,wEnemy2LevelLabel,wEnemy3LevelLabel,
  480.                    wEnemy4LevelLabel,wEnemy5LevelLabel]
  481. wEnemiesKeyLabels=[wEnemy1KeyLabel,wEnemy2KeyLabel,wEnemy3KeyLabel,
  482.                    wEnemy4KeyLabel,wEnemy5KeyLabel]
  483. wEnemiesObjLabels=[wEnemy1ObjLabel,wEnemy2ObjLabel,wEnemy3ObjLabel,
  484.                    wEnemy4ObjLabel,wEnemy5ObjLabel]
  485. wEnemyBarrLabels =[wEnemy1BarrLabel,wEnemy2BarrLabel,wEnemy3BarrLabel,
  486.                    wEnemy4BarrLabel,wEnemy5BarrLabel]
  487.  
  488.  
  489. wLeftFrame.AddWidget(wLifeBar,14,6)
  490. wLeftFrame.AddWidget(wLevelBar,14,24)
  491. wLeftFrame.AddWidget(wLifeMarker,1,1)
  492.  
  493. wObjectsFrame.AddWidget(wKey1,0,72)
  494. #wKeysRFrame.AddWidget(wKey2,0,6)
  495.  
  496. wLeftFrame.AddWidget(wSpecialsFrame,15,38)
  497. #wRightFrame.AddWidget(wKeysFrame,8,95)
  498.  
  499. wSpecialsFrame.AddWidget(wSpecialKey1,0,0)
  500. wSpecialsFrame.AddWidget(wSpecialKey2,21,0)
  501. wSpecialsFrame.AddWidget(wSpecialKey3,43,0)
  502. wSpecialsFrame.AddWidget(wSpecialKey4,65,0)
  503.  
  504. dlt = 0
  505. wSpecialsFrame.AddWidget(wTablet1, 96-dlt,0)
  506. wSpecialsFrame.AddWidget(wTablet2,110-dlt,0)
  507. wSpecialsFrame.AddWidget(wTablet3,124-dlt,0)
  508. wSpecialsFrame.AddWidget(wTablet4,138-dlt,0)
  509. wSpecialsFrame.AddWidget(wTablet5,152-dlt,0)
  510. wSpecialsFrame.AddWidget(wTablet6,166-dlt,0)
  511.  
  512.  
  513. """
  514. wObjectsFrame.AddWidget(wSelObjectText,0.5,53,
  515.                         BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter,
  516.                         BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  517. """
  518.  
  519.  
  520. wEnemyLeft=BUIx.B_BitmapWidget(wEnemiesFrame,"FlechaIzquierda",40,40,"FLECHAENEMIGODERECHA","../../Data/flechaenemigoderecha.mmp")
  521. wEnemiesFrame.AddWidget(wEnemyLeft,0,E_EDGAL_DISTANCE,
  522.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  523. wEnemyLeft.SetAlpha(1.0)
  524. wEnemyLeft.SetColor(255,255,255)
  525.  
  526.  
  527. i = 0
  528. c = 0
  529. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  530.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  531. i = 1
  532. c = 0
  533. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  534.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  535.  
  536.  
  537. # Marcador centraL
  538. wEnemyMark=BUIx.B_BitmapWidget(wEnemiesFrame,"SelectorEnemigo",80,80,"SELECTORENEMIGO","../../Data/selectorenemigo.mmp");
  539. wEnemiesFrame.AddWidget(wEnemyMark,0.56,-10,
  540.                            BUIx.B_FrameWidget.B_FR_HRelative,  BUIx.B_FrameWidget.B_FR_HCenter,
  541.                            BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  542. wEnemyMark.SetAlpha(1.0)
  543. wEnemyMark.SetColor(255,255,255)
  544.  
  545.  
  546. i = 2
  547. c = 1
  548. # Cuadrado rojo
  549. wEnemyBorderSelector=BUIx.B_RectWidget(wEnemies[i],"CentralBitmapBorder",35,35)
  550. wEnemyBorderSelector.SetBorderColor(255,0,0)
  551. wEnemies[i].AddLabel(wEnemyBorderSelector,0,0,
  552.                     BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter,
  553.                     BUIx.B_Widget.B_FR_Left,BUIx.B_Widget.B_FR_Left,
  554.                     BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top
  555.                     )
  556. # Enemigo del centro
  557. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  558.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  559.  
  560.  
  561.  
  562.  
  563. i = 3
  564. c = 2
  565. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  566.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  567.  
  568. i = 4
  569. c = 2
  570. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  571.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  572.  
  573.  
  574. wEnemyRight=BUIx.B_BitmapWidget(wEnemiesFrame,"FlechaDerecha",40,40,"FLECHAENEMIGOIZQUIERDA","../../Data/flechaenemigoizquierda.mmp");
  575. wEnemiesFrame.AddWidget(wEnemyRight,E_ICON_DISTANCE*5+2*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  576.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  577. wEnemyRight.SetAlpha(1.0)
  578. wEnemyRight.SetColor(255,255,255)
  579.  
  580.  
  581. InitAlpha=[1.0,0.3,0.2,0.1]
  582. InitPositions=[(5,10),(35,20),(75,30),(110,40)]
  583. wRightHand=ScorerWidgets.B_HandWidget(wFrame,"RightHand",150,150,"Right",
  584.                                       InitAlpha,InitPositions)
  585. wLeftHand=ScorerWidgets.B_HandWidget(wFrame,"LefttHand",150,150,"Left",
  586.                                       InitAlpha,InitPositions)
  587.                                       
  588. wArrowInfo=ScorerWidgets.InvArrowsControl(wFrame,"ArrowInfo",150,150,char)
  589.  
  590. #wQuiverHand=ScorerWidgets.B_HandWidget(wFrame,"LefttHand",150,150,"Left",
  591. #                                      InitAlpha,InitPositions)
  592.  
  593.  
  594.  
  595.  
  596. wFrame.AddWidget(wLeftFrame,4,4)
  597. #wFrame.AddWidget(wKeysRFrame,196,0)
  598. wFrame.AddWidget(wObjectsFrame,12,0,BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_Right,
  599.                               BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  600.  
  601.  
  602. wFrame.AddWidget(wEnemiesFrame,0.5,0,BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter,
  603.                               BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  604. wFrame.AddWidget(wRightHand,6,20,BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_Right,
  605.                               BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  606. wFrame.AddWidget(wLeftHand,6,20,BUIx.B_FrameWidget.B_FR_AbsoluteLeft,BUIx.B_FrameWidget.B_FR_Left,
  607.                               BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  608. wFrame.AddWidget(wArrowInfo,6,20,BUIx.B_FrameWidget.B_FR_AbsoluteLeft,BUIx.B_FrameWidget.B_FR_Left,
  609.                               BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  610.  
  611.  
  612. wFrame.AddWidget(wGameText,0.5,27,
  613.                            BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter,
  614.                            BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  615.  
  616.  
  617. wFrame.AddWidget(wLowBarFrame,0.5,2,
  618.                            BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter,
  619.                            BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  620.  
  621.  
  622. #wFrame.SetFocus("LeftFrame")
  623. #wFrame.SetClipDraw(1)
  624.  
  625.  
  626. ShieldsControl=ScorerWidgets.InvShieldControl("Shields",wLeftHand,char,
  627.                                               view_period=1.4,cycle_period=0.3,fadein_period=0.3,
  628.                                               fadeout_period=0.3,
  629.                                               end_cycle_callback=ScorerActions.CB_ShieldOut,
  630.                                               Wants_auto_scale=wants_auto_scale)
  631. WeaponsControl=ScorerWidgets.InvWeaponsControl("Weapons",wRightHand,char,ShieldsControl,
  632.                                               view_period=1.4,cycle_period=0.3,fadein_period=0.3,
  633.                                               fadeout_period=0.3,
  634.                                               end_cycle_callback=ScorerActions.CB_WeaponOut,
  635.                                               Wants_auto_scale=wants_auto_scale)
  636. ObjectsControl=ScorerWidgets.InvObjectsControl("Objects",wObjectsFrame,char,
  637.                                               view_period=1.4,cycle_period=0.2,fadein_period=0.3,
  638.                                               fadeout_period=0.3,
  639.                                               end_cycle_callback=ScorerActions.IncCallBack,
  640.                                               Wants_auto_scale=wants_auto_scale)
  641.  
  642.  
  643.  
  644. PowDefWidgets.CreateWidgest()
  645. PowDefWidgets.Activate()
  646.  
  647.  
  648. wFrame.SetAutoScale(1)
  649. if wants_auto_scale:
  650.   wLeftFrame.SetAutoScale(1)
  651.   wEnemiesFrame.SetAutoScale(1)
  652.   wLowBarFrame.SetAutoScale(1)
  653.   wObjectsFrame.SetAutoScale(1)
  654.   #wKeysFrame.SetAutoScale(1)
  655.   #wKeysRFrame.SetAutoScale(1)
  656.   wSpecialsFrame.SetAutoScale(1)
  657.  
  658.   wGameText.SetAutoScale(1)
  659.   wLifeBar.SetAutoScale(1)
  660.   wLifeLabel.SetAutoScale(1)
  661.   wPoisonLabel.SetAutoScale(1)
  662.   wLevelBar.SetAutoScale(1)
  663.   wLevelUpLabel.SetAutoScale(1)
  664.   wLevelBar.SetAutoScale(1)
  665.   wCurrentLevelLabel.SetAutoScale(1)
  666.   wStrengthBar.SetAutoScale(1)
  667.   wMaxPowerLabel.SetAutoScale(1)
  668.   wStrengthLabel.SetAutoScale(1)
  669.   wEnergyBar.SetAutoScale(1)
  670.   wDangerLabel.SetAutoScale(1)
  671.   wEnergyMaxLabel.SetAutoScale(1)
  672.   TBookSword.SetAutoScale(1)
  673.   wLifeMarker.SetAutoScale(1)
  674.   wEnergyBmp.SetAutoScale(1)
  675.  
  676.   wKey1.SetAutoScale(1)
  677.   #wKey2.SetAutoScale(1)
  678.  
  679.   wSpecialKey1.SetAutoScale(1)
  680.   wSpecialKey2.SetAutoScale(1)
  681.   wSpecialKey3.SetAutoScale(1)
  682.   wSpecialKey4.SetAutoScale(1)
  683.  
  684.   wTablet1.SetAutoScale(1)
  685.   wTablet2.SetAutoScale(1)
  686.   wTablet3.SetAutoScale(1)
  687.   wTablet4.SetAutoScale(1)
  688.   wTablet5.SetAutoScale(1)
  689.   wTablet6.SetAutoScale(1)
  690.  
  691.   wEnemyBorderSelector.SetAutoScale(1)
  692.   wEnemyLeft.SetAutoScale(1)
  693.   wEnemyRight.SetAutoScale(1)
  694.   wEnemyMark.SetAutoScale(1)
  695.   for x in range(5):
  696.     wEnemies[x].SetAutoScale(1)
  697.     wEnemiesVenoms[x].SetAutoScale(1)
  698.     wEnemiesLifeLabels[x].SetAutoScale(1)
  699.     wEnemiesLevelLabels[x].SetAutoScale(1)
  700.     wEnemiesKeyLabels[x].SetAutoScale(1)
  701.     wEnemiesObjLabels[x].SetAutoScale(1)
  702.     wEnemyBarrLabels[x].SetAutoScale(1)
  703.  
  704.  
  705.   wEnemyBorderSelector.SetAutoScale(1)
  706.   wEnemyLeft.SetAutoScale(1)
  707.   wEnemyRight.SetAutoScale(1)
  708.   wEnemyMark.SetAutoScale(1)
  709.   for x in range(5):
  710.     wEnemies[x].SetAutoScale(1)
  711.     wEnemiesVenoms[x].SetAutoScale(1)
  712.     wEnemiesLifeLabels[x].SetAutoScale(1)
  713.     wEnemiesLevelLabels[x].SetAutoScale(1)
  714.     wEnemiesKeyLabels[x].SetAutoScale(1)
  715.     wEnemiesObjLabels[x].SetAutoScale(1)
  716.     wEnemyBarrLabels[x].SetAutoScale(1)
  717.  
  718.  
  719.   PowDefWidgets.DefTextWidget.SetAutoScale(1)
  720.   PowDefWidgets.PowTextWidget.SetAutoScale(1)
  721.   PowDefWidgets.DefBmpWidget.SetAutoScale(1)
  722.   PowDefWidgets.PowBmpWidget.SetAutoScale(1)
  723.   PowDefWidgets.wDefFrame.SetAutoScale(1)
  724.   PowDefWidgets.wPowFrame.SetAutoScale(1)
  725.  
  726.  
  727.  
  728.  
  729. ObjectsControl.view_period = 3.0  # Modify it to change the time of the inventory.
  730.  
  731. def ActivateScorer():
  732.     wLeftHand.SetVisible(0)
  733.     wRightHand.SetVisible(0)
  734.     wObjectsFrame.SetVisible(0)
  735.     #wKeysFrame.SetVisible(1)
  736.     #wKeysRFrame.SetVisible(1)
  737.     wSpecialsFrame.SetVisible(1)
  738.     Bladex.SetRootWidget(wFrame.GetPointer())
  739.  
  740. def ViewScorer(v):
  741.   wFrame.SetVisible(v)
  742.  
  743.  
  744. def ViewEnemies(v):
  745.   wEnemiesFrame.SetVisible(v)
  746.  
  747.  
  748. def ViewBars(v):
  749.   wLeftFrame.SetVisible(v)
  750.  
  751.  
  752.  
  753.  
  754. def ViewObjects(v):
  755.   wObjectsFrame.SetVisible(v)
  756.  
  757.  
  758.  
  759. def AddLifeValue(v):
  760.   wLifeBar.AddValue(v)
  761.   #print str(v)
  762.   #wLifeLabel.SetText(str(v))
  763.  
  764.  
  765. last_poisoned=0
  766.  
  767. def SetLifeValue(v,maxvalue,poisoned):
  768.   global last_poisoned
  769.   #Bldb.set_trace()
  770.   wLifeBar.SetPositionPercentage(v/maxvalue*(6.5/8.0))
  771.   wLifeLabel.SetText(str(int(v))+"/"+str(maxvalue))
  772.   
  773.   if poisoned!=last_poisoned:
  774.     wPoisonLabel.SetVisible(poisoned)
  775.     last_poisoned=poisoned
  776.     if poisoned:
  777.       wLifeBar.SetColor(0,66,19)
  778.       wLifeBar.SetFlash(3)      
  779.       #wLifeBar2.SetColor(0,83,24)
  780.     else:
  781.       wLifeBar.SetColor(255,0,0)
  782.       wLifeBar.SetFlash(0)
  783.       #wLifeBar2.SetColor(163,28,0)
  784.       
  785.  
  786. def SetLevelValue(v):
  787.   wCurrentLevelLabel.SetText(MenuText.GetMenuText("Level")+" "+str(v+1))
  788.  
  789.  
  790.  
  791. def SetLevelBarValue(v):
  792.   wLevelBar.SetPosition(v*(6.5/8.0))
  793.  
  794.  
  795.  
  796. def SetLevelLimits(inf,sup):
  797.   wLevelBar.SetLimits(inf,sup)
  798.  
  799.  
  800.  
  801.  
  802. def __level_up_aux():
  803.   wLevelUpLabel.SetFlash(0)
  804.   wLevelUpLabel.SetVisible(0)
  805.  
  806.  
  807. def LevelUp():
  808.   wLevelUpLabel.SetFlash(15)
  809.   wLevelUpLabel.SetVisible(1)
  810.   now=Bladex.GetTime()
  811.   Bladex.AddScheduledFunc(now+2.0,__level_up_aux,())
  812.  
  813. VISIBLE=1
  814.  
  815. def SetStrengthBarValue(v):
  816.   wEnergyBar.SetVisible(0)
  817.   if VISIBLE:
  818.       wStrengthBar.SetVisible(1)
  819.  
  820.   old_pos= wStrengthBar.GetPositionPercentage()
  821.   wStrengthBar.SetPositionPercentage(v*(6.5/8.0))  
  822.   
  823.   if v>=1.0:
  824.     if old_pos<1.0:
  825.         wMaxPowerLabel.SetFlash(14)
  826.         wStrengthLabel.SetFlash(14)
  827.         wMaxPowerLabel.SetVisible(1)
  828.   else:
  829.       wMaxPowerLabel.SetVisible(0)
  830.       wStrengthLabel.SetFlash(0.0)
  831.  
  832. def SetEnergyBarValue(v, max_v):
  833.   wStrengthBar.SetVisible(0)  
  834.   if VISIBLE:
  835.       wEnergyBar.SetVisible(1)    
  836.   pos= min(max(v/max_v, 0),1.0)
  837.   wEnergyBar.SetPositionPercentage(pos*(6.5/8.0))
  838.   wEnergyMaxLabel.SetText(`max_v`)
  839.   wEnergyBar.RecalcLabelLayout(BUIx.B_Widget.B_LAB_Left,BUIx.B_Widget.B_LAB_VCenter)
  840.   if pos<=ENERGY_LOW_LEVEL:            
  841.       wDangerLabel.SetFlash(14)      
  842.       wDangerLabel.SetVisible(1)
  843.   else:
  844.       wDangerLabel.SetVisible(0)  
  845.  
  846. def SetVisible(vis):
  847.   global VISIBLE
  848.   VISIBLE=vis
  849.   if vis==0:
  850.     HideTBS()
  851.     wLeftHand.SetVisible(vis)
  852.     wRightHand.SetVisible(0)
  853.     PowDefWidgets.Deactivate()
  854.   else:
  855.     PowDefWidgets.Activate()
  856.   #wKeysFrame.SetVisible(vis)
  857.   #wKeysRFrame.SetVisible(vis)
  858.   wSpecialsFrame.SetVisible(vis)
  859.   wEnemiesFrame.SetVisible(vis)
  860.   wLeftFrame.SetVisible(vis)
  861.   wArrowInfo.SetVisible(vis)
  862.  
  863.   wEnergyBar.SetVisible(0)
  864.   wStrengthBar.SetVisible(0)
  865.   wStrengthBar.SetVisible(0)
  866.   wLowBarFrame.SetVisible(0)
  867.   wObjectsFrame.SetVisible(0)
  868.  
  869.  
  870. def LevelUpFlash():
  871.     global wLifeBar
  872.     
  873.     
  874.     if not wLifeBar.GetFlash():
  875.         wLifeBar.SetFlash(22)
  876.         Bladex.AddScheduledFunc (Bladex.GetTime() + 2.0,wLifeBar.SetFlash,(0,))
  877.     
  878.     PowDefWidgets.FlashWidgest()